<!doctype html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta name="author" content="order by dede58.com"/>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>笔记库后台-权限管理</title>
    <#include "public/link_css.ftl">
    <#include "public/link_js.ftl">
    <#--    <script>window.location.href='upgrade-browser.html';</script>-->
</head>

<body class="user-select">
<section class="container-fluid">
    <#include "public/header.ftl">
    <div class="row">
        <#include "public/left.ftl">
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-lg-10 col-md-offset-2 main" id="main">
            <div class="row">
                <div class="col-md-5">
                    <h1 class="page-header">添加</h1>
                    <form action="/admin/permission/add" method="post" autocomplete="off">
                        <div class="form-group">
                            <label for="category-name">权限名称</label>
                            <input type="text" id="category-name" name="name" class="form-control"
                                   placeholder="在此处输入权限名称" required autocomplete="off">
                        </div>
                        <div class="form-group">
                            <label for="category-name">权限类型</label>
                            <label class="radio-inline">
                                <input type="radio" name="resourceType" value="menu"> 菜单
                            </label>
                            <label class="radio-inline">
                                <input type="radio" name="resourceType" value="button"> 权限
                            </label>
                        </div>
                        <div class="form-group">
                            <label for="category-name">资源路径</label>
                            <input type="text" id="category-name" name="url" class="form-control"
                                   placeholder="在此处输入资源路径" autocomplete="off">
                        </div>
                        <div class="form-group">
                            <label for="category-name">权限描述</label>
                            <input type="text" id="category-name" name="permission" class="form-control"
                                   placeholder="在此处输入权限描述 例：role:update..." autocomplete="off">
                        </div>

                        <button class="btn btn-primary" type="submit" name="submit">添加新权限</button>
                    </form>
                </div>
                <div class="col-md-7">
                    <h1 class="page-header">管理 <span class="badge">${permissionCount}</span></h1>
                    <div class="table-responsive">
                        <table class="table table-striped table-hover">
                            <thead>
                            <tr>
                                <th><span class="glyphicon glyphicon-paperclip"></span> <span
                                            class="visible-lg">ID</span></th>
                                <th><span class="glyphicon glyphicon-file"></span>
                                    <span class="visible-lg">权限名称</span>
                                </th>
                                <th><span class="glyphicon glyphicon-list-alt"></span> <span
                                            class="visible-lg">权限类型</span></th>
                                <th><span class="glyphicon glyphicon-list-alt"></span> <span
                                            class="visible-lg">资源路径</span></th>
                                <th><span class="glyphicon glyphicon-list-alt"></span> <span
                                            class="visible-lg">权限描述</span></th>
                                <th><span class="glyphicon glyphicon-list-alt"></span> <span
                                            class="visible-lg">是否可用</span></th>
                                <th><span class="glyphicon glyphicon-pencil"></span>
                                    <span class="visible-lg">操作</span>
                                </th>
                            </tr>
                            </thead>
                            <tbody>
                            <#if permissionManagerList??>
                                <#list permissionManagerList as permission>
                                    <tr>
                                        <td>${permission.id}</td>
                                        <td>${permission.name}</td>
                                        <#if permission.resourceType == "menu">
                                            <td>菜单</td>
                                        <#elseif permission.resourceType == "button">
                                            <td>权限按钮</td>
                                        </#if>
                                        <#if permission.url??>
                                            <td>${permission.url}</td>
                                        <#else>
                                            <td></td>
                                        </#if>
                                        <#if permission.permission??>
                                            <td>${permission.permission}</td>
                                        <#else>
                                            <td></td>
                                        </#if>
                                        <td>
                                            <#if permission.available==1>
                                                可用
                                            <#else>
                                                不可用
                                            </#if>
                                        </td>
                                        <td><a href="/admin/permission/update?id=${permission.id}">修改</a>
                                            <a href="/admin/permission/delete?id=${permission.id}">删除</a>
                                        </td>
                                    </tr>
                                </#list>
                            </#if>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>

    </div>
</section>

</body>
</html>
